<template>
  <el-dialog
    :title="!dataForm.id ? '新增' : '修改'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
    <el-form-item label="发送登记中心时间" prop="sendtime">
      <el-input v-model="dataForm.sendtime" placeholder="发送登记中心时间"></el-input>
    </el-form-item>
    <el-form-item label="接收登记中心时间" prop="recvtime">
      <el-input v-model="dataForm.recvtime" placeholder="接收登记中心时间"></el-input>
    </el-form-item>
    <el-form-item label="发起网点号" prop="obankid">
      <el-input v-model="dataForm.obankid" placeholder="发起网点号"></el-input>
    </el-form-item>
    <el-form-item label="业务标识码" prop="servicecode">
      <el-input v-model="dataForm.servicecode" placeholder="业务标识码"></el-input>
    </el-form-item>
    <el-form-item label="业务类型" prop="ywlx">
      <el-input v-model="dataForm.ywlx" placeholder="业务类型"></el-input>
    </el-form-item>
    <el-form-item label="业务类别:1-抵押注销;2-预告登记;3-预抵登记;4-自助预转本；5-人工预转本;6-一般抵押登记;7-最高抵押登记；8-全程网办" prop="btype">
      <el-input v-model="dataForm.btype" placeholder="业务类别:1-抵押注销;2-预告登记;3-预抵登记;4-自助预转本；5-人工预转本;6-一般抵押登记;7-最高抵押登记；8-全程网办"></el-input>
    </el-form-item>
    <el-form-item label="登记事项" prop="djsx">
      <el-input v-model="dataForm.djsx" placeholder="登记事项"></el-input>
    </el-form-item>
    <el-form-item label="不动产登记证明号" prop="realtyno">
      <el-input v-model="dataForm.realtyno" placeholder="不动产登记证明号"></el-input>
    </el-form-item>
    <el-form-item label="抵押面积" prop="dymj">
      <el-input v-model="dataForm.dymj" placeholder="抵押面积"></el-input>
    </el-form-item>
    <el-form-item label="抵押注销原因:见数据字典" prop="zxyy">
      <el-input v-model="dataForm.zxyy" placeholder="抵押注销原因:见数据字典"></el-input>
    </el-form-item>
    <el-form-item label="区划代码" prop="region">
      <el-input v-model="dataForm.region" placeholder="区划代码"></el-input>
    </el-form-item>
    <el-form-item label="办理点" prop="bld">
      <el-input v-model="dataForm.bld" placeholder="办理点"></el-input>
    </el-form-item>
    <el-form-item label="附记" prop="fj">
      <el-input v-model="dataForm.fj" placeholder="附记"></el-input>
    </el-form-item>
    <el-form-item label="是否电子影像标识:1-是;0-否" prop="isdzyxyw">
      <el-input v-model="dataForm.isdzyxyw" placeholder="是否电子影像标识:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在登记人员信息集:1-是;0-否" prop="isdjryset">
      <el-input v-model="dataForm.isdjryset" placeholder="是否存在登记人员信息集:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在不动产信息集:1-是;0-否" prop="isbdcset">
      <el-input v-model="dataForm.isbdcset" placeholder="是否存在不动产信息集:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在询问笔录信息集:1-是;0-否" prop="isxwblset">
      <el-input v-model="dataForm.isxwblset" placeholder="是否存在询问笔录信息集:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在合同备案信息集:1-是;0-否" prop="ishtbaset">
      <el-input v-model="dataForm.ishtbaset" placeholder="是否存在合同备案信息集:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="被担保债权数额" prop="bdbzqse">
      <el-input v-model="dataForm.bdbzqse" placeholder="被担保债权数额"></el-input>
    </el-form-item>
    <el-form-item label="债务履约起始时间" prop="zwlxqssj">
      <el-input v-model="dataForm.zwlxqssj" placeholder="债务履约起始时间"></el-input>
    </el-form-item>
    <el-form-item label="债务履约结束时间" prop="zwlxjssj">
      <el-input v-model="dataForm.zwlxjssj" placeholder="债务履约结束时间"></el-input>
    </el-form-item>
    <el-form-item label="担保范围" prop="dbfw">
      <el-input v-model="dataForm.dbfw" placeholder="担保范围"></el-input>
    </el-form-item>
    <el-form-item label="并案标识码(合并编码)" prop="babsm">
      <el-input v-model="dataForm.babsm" placeholder="并案标识码(合并编码)"></el-input>
    </el-form-item>
    <el-form-item label="集体件标识码" prop="jtjbsm">
      <el-input v-model="dataForm.jtjbsm" placeholder="集体件标识码"></el-input>
    </el-form-item>
    <el-form-item label="是否自动预转本:1-不自动预转本;2-转一般抵押;3-转最高额抵押" prop="iszzyzb">
      <el-input v-model="dataForm.iszzyzb" placeholder="是否自动预转本:1-不自动预转本;2-转一般抵押;3-转最高额抵押"></el-input>
    </el-form-item>
    <el-form-item label="带抵押过户标识" prop="isdygh">
      <el-input v-model="dataForm.isdygh" placeholder="带抵押过户标识"></el-input>
    </el-form-item>
    <el-form-item label="拟抵押业务标识,固定值"1"" prop="isndy">
      <el-input v-model="dataForm.isndy" placeholder="拟抵押业务标识,固定值"1""></el-input>
    </el-form-item>
    <el-form-item label="是否办理公证委托:1-是;0-否" prop="isgzwt">
      <el-input v-model="dataForm.isgzwt" placeholder="是否办理公证委托:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="抵押情况确认" prop="dyconfirm">
      <el-input v-model="dataForm.dyconfirm" placeholder="抵押情况确认"></el-input>
    </el-form-item>
    <el-form-item label="业务件号" prop="serviceno">
      <el-input v-model="dataForm.serviceno" placeholder="业务件号"></el-input>
    </el-form-item>
    <el-form-item label="受理号" prop="slh">
      <el-input v-model="dataForm.slh" placeholder="受理号"></el-input>
    </el-form-item>
    <el-form-item label="受理时间" prop="slsj">
      <el-input v-model="dataForm.slsj" placeholder="受理时间"></el-input>
    </el-form-item>
    <el-form-item label="并案号" prop="bah">
      <el-input v-model="dataForm.bah" placeholder="并案号"></el-input>
    </el-form-item>
    <el-form-item label="是否存在预抵抵押人集合:1-是;0-否" prop="isyddyrset">
      <el-input v-model="dataForm.isyddyrset" placeholder="是否存在预抵抵押人集合:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在抵押:1-是;0-否" prop="isczdy">
      <el-input v-model="dataForm.isczdy" placeholder="是否存在抵押:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在查封:1-是;0-否" prop="isczcf">
      <el-input v-model="dataForm.isczcf" placeholder="是否存在查封:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="是否存在在办:1-是;0-否" prop="isczzb">
      <el-input v-model="dataForm.isczzb" placeholder="是否存在在办:1-是;0-否"></el-input>
    </el-form-item>
    <el-form-item label="领证方式" prop="lzfs">
      <el-input v-model="dataForm.lzfs" placeholder="领证方式"></el-input>
    </el-form-item>
    <el-form-item label="是否存在签名申请书集合:1-是;2-否" prop="isqmsqsset">
      <el-input v-model="dataForm.isqmsqsset" placeholder="是否存在签名申请书集合:1-是;2-否"></el-input>
    </el-form-item>
    <el-form-item label="查封机构" prop="cfjg">
      <el-input v-model="dataForm.cfjg" placeholder="查封机构"></el-input>
    </el-form-item>
    <el-form-item label="查封时间" prop="cfsj">
      <el-input v-model="dataForm.cfsj" placeholder="查封时间"></el-input>
    </el-form-item>
    <el-form-item label="解封机构" prop="jfjg">
      <el-input v-model="dataForm.jfjg" placeholder="解封机构"></el-input>
    </el-form-item>
    <el-form-item label="解封时间" prop="jfsj">
      <el-input v-model="dataForm.jfsj" placeholder="解封时间"></el-input>
    </el-form-item>
    <el-form-item label="是否已抵押注销:1-已抵押注销;0-未抵押注销" prop="isdyzx">
      <el-input v-model="dataForm.isdyzx" placeholder="是否已抵押注销:1-已抵押注销;0-未抵押注销"></el-input>
    </el-form-item>
    <el-form-item label="业务状态" prop="status">
      <el-input v-model="dataForm.status" placeholder="业务状态"></el-input>
    </el-form-item>
    <el-form-item label="结果描述" prop="descinfo">
      <el-input v-model="dataForm.descinfo" placeholder="结果描述"></el-input>
    </el-form-item>
    <el-form-item label="备注" prop="remark">
      <el-input v-model="dataForm.remark" placeholder="备注"></el-input>
    </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          seqno: 0,
          sendtime: '',
          recvtime: '',
          obankid: '',
          servicecode: '',
          ywlx: '',
          btype: '',
          djsx: '',
          realtyno: '',
          dymj: '',
          zxyy: '',
          region: '',
          bld: '',
          fj: '',
          isdzyxyw: '',
          isdjryset: '',
          isbdcset: '',
          isxwblset: '',
          ishtbaset: '',
          bdbzqse: '',
          zwlxqssj: '',
          zwlxjssj: '',
          dbfw: '',
          babsm: '',
          jtjbsm: '',
          iszzyzb: '',
          isdygh: '',
          isndy: '',
          isgzwt: '',
          dyconfirm: '',
          serviceno: '',
          slh: '',
          slsj: '',
          bah: '',
          isyddyrset: '',
          isczdy: '',
          isczcf: '',
          isczzb: '',
          lzfs: '',
          isqmsqsset: '',
          cfjg: '',
          cfsj: '',
          jfjg: '',
          jfsj: '',
          isdyzx: '',
          status: '',
          descinfo: '',
          remark: ''
        },
        dataRule: {
          sendtime: [
            { required: true, message: '发送登记中心时间不能为空', trigger: 'blur' }
          ],
          recvtime: [
            { required: true, message: '接收登记中心时间不能为空', trigger: 'blur' }
          ],
          obankid: [
            { required: true, message: '发起网点号不能为空', trigger: 'blur' }
          ],
          servicecode: [
            { required: true, message: '业务标识码不能为空', trigger: 'blur' }
          ],
          ywlx: [
            { required: true, message: '业务类型不能为空', trigger: 'blur' }
          ],
          btype: [
            { required: true, message: '业务类别:1-抵押注销;2-预告登记;3-预抵登记;4-自助预转本；5-人工预转本;6-一般抵押登记;7-最高抵押登记；8-全程网办不能为空', trigger: 'blur' }
          ],
          djsx: [
            { required: true, message: '登记事项不能为空', trigger: 'blur' }
          ],
          realtyno: [
            { required: true, message: '不动产登记证明号不能为空', trigger: 'blur' }
          ],
          dymj: [
            { required: true, message: '抵押面积不能为空', trigger: 'blur' }
          ],
          zxyy: [
            { required: true, message: '抵押注销原因:见数据字典不能为空', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '区划代码不能为空', trigger: 'blur' }
          ],
          bld: [
            { required: true, message: '办理点不能为空', trigger: 'blur' }
          ],
          fj: [
            { required: true, message: '附记不能为空', trigger: 'blur' }
          ],
          isdzyxyw: [
            { required: true, message: '是否电子影像标识:1-是;0-否不能为空', trigger: 'blur' }
          ],
          isdjryset: [
            { required: true, message: '是否存在登记人员信息集:1-是;0-否不能为空', trigger: 'blur' }
          ],
          isbdcset: [
            { required: true, message: '是否存在不动产信息集:1-是;0-否不能为空', trigger: 'blur' }
          ],
          isxwblset: [
            { required: true, message: '是否存在询问笔录信息集:1-是;0-否不能为空', trigger: 'blur' }
          ],
          ishtbaset: [
            { required: true, message: '是否存在合同备案信息集:1-是;0-否不能为空', trigger: 'blur' }
          ],
          bdbzqse: [
            { required: true, message: '被担保债权数额不能为空', trigger: 'blur' }
          ],
          zwlxqssj: [
            { required: true, message: '债务履约起始时间不能为空', trigger: 'blur' }
          ],
          zwlxjssj: [
            { required: true, message: '债务履约结束时间不能为空', trigger: 'blur' }
          ],
          dbfw: [
            { required: true, message: '担保范围不能为空', trigger: 'blur' }
          ],
          babsm: [
            { required: true, message: '并案标识码(合并编码)不能为空', trigger: 'blur' }
          ],
          jtjbsm: [
            { required: true, message: '集体件标识码不能为空', trigger: 'blur' }
          ],
          iszzyzb: [
            { required: true, message: '是否自动预转本:1-不自动预转本;2-转一般抵押;3-转最高额抵押不能为空', trigger: 'blur' }
          ],
          isdygh: [
            { required: true, message: '带抵押过户标识不能为空', trigger: 'blur' }
          ],
          isndy: [
            { required: true, message: '拟抵押业务标识,固定值"1"不能为空', trigger: 'blur' }
          ],
          isgzwt: [
            { required: true, message: '是否办理公证委托:1-是;0-否不能为空', trigger: 'blur' }
          ],
          dyconfirm: [
            { required: true, message: '抵押情况确认不能为空', trigger: 'blur' }
          ],
          serviceno: [
            { required: true, message: '业务件号不能为空', trigger: 'blur' }
          ],
          slh: [
            { required: true, message: '受理号不能为空', trigger: 'blur' }
          ],
          slsj: [
            { required: true, message: '受理时间不能为空', trigger: 'blur' }
          ],
          bah: [
            { required: true, message: '并案号不能为空', trigger: 'blur' }
          ],
          isyddyrset: [
            { required: true, message: '是否存在预抵抵押人集合:1-是;0-否不能为空', trigger: 'blur' }
          ],
          isczdy: [
            { required: true, message: '是否存在抵押:1-是;0-否不能为空', trigger: 'blur' }
          ],
          isczcf: [
            { required: true, message: '是否存在查封:1-是;0-否不能为空', trigger: 'blur' }
          ],
          isczzb: [
            { required: true, message: '是否存在在办:1-是;0-否不能为空', trigger: 'blur' }
          ],
          lzfs: [
            { required: true, message: '领证方式不能为空', trigger: 'blur' }
          ],
          isqmsqsset: [
            { required: true, message: '是否存在签名申请书集合:1-是;2-否不能为空', trigger: 'blur' }
          ],
          cfjg: [
            { required: true, message: '查封机构不能为空', trigger: 'blur' }
          ],
          cfsj: [
            { required: true, message: '查封时间不能为空', trigger: 'blur' }
          ],
          jfjg: [
            { required: true, message: '解封机构不能为空', trigger: 'blur' }
          ],
          jfsj: [
            { required: true, message: '解封时间不能为空', trigger: 'blur' }
          ],
          isdyzx: [
            { required: true, message: '是否已抵押注销:1-已抵押注销;0-未抵押注销不能为空', trigger: 'blur' }
          ],
          status: [
            { required: true, message: '业务状态不能为空', trigger: 'blur' }
          ],
          descinfo: [
            { required: true, message: '结果描述不能为空', trigger: 'blur' }
          ],
          remark: [
            { required: true, message: '备注不能为空', trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      init (id) {
        this.dataForm.seqno = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.seqno) {
            this.$http({
              url: this.$http.adornUrl(`/bdc/bdcmortgregist/info/${this.dataForm.seqno}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.sendtime = data.bdcMortgregist.sendtime
                this.dataForm.recvtime = data.bdcMortgregist.recvtime
                this.dataForm.obankid = data.bdcMortgregist.obankid
                this.dataForm.servicecode = data.bdcMortgregist.servicecode
                this.dataForm.ywlx = data.bdcMortgregist.ywlx
                this.dataForm.btype = data.bdcMortgregist.btype
                this.dataForm.djsx = data.bdcMortgregist.djsx
                this.dataForm.realtyno = data.bdcMortgregist.realtyno
                this.dataForm.dymj = data.bdcMortgregist.dymj
                this.dataForm.zxyy = data.bdcMortgregist.zxyy
                this.dataForm.region = data.bdcMortgregist.region
                this.dataForm.bld = data.bdcMortgregist.bld
                this.dataForm.fj = data.bdcMortgregist.fj
                this.dataForm.isdzyxyw = data.bdcMortgregist.isdzyxyw
                this.dataForm.isdjryset = data.bdcMortgregist.isdjryset
                this.dataForm.isbdcset = data.bdcMortgregist.isbdcset
                this.dataForm.isxwblset = data.bdcMortgregist.isxwblset
                this.dataForm.ishtbaset = data.bdcMortgregist.ishtbaset
                this.dataForm.bdbzqse = data.bdcMortgregist.bdbzqse
                this.dataForm.zwlxqssj = data.bdcMortgregist.zwlxqssj
                this.dataForm.zwlxjssj = data.bdcMortgregist.zwlxjssj
                this.dataForm.dbfw = data.bdcMortgregist.dbfw
                this.dataForm.babsm = data.bdcMortgregist.babsm
                this.dataForm.jtjbsm = data.bdcMortgregist.jtjbsm
                this.dataForm.iszzyzb = data.bdcMortgregist.iszzyzb
                this.dataForm.isdygh = data.bdcMortgregist.isdygh
                this.dataForm.isndy = data.bdcMortgregist.isndy
                this.dataForm.isgzwt = data.bdcMortgregist.isgzwt
                this.dataForm.dyconfirm = data.bdcMortgregist.dyconfirm
                this.dataForm.serviceno = data.bdcMortgregist.serviceno
                this.dataForm.slh = data.bdcMortgregist.slh
                this.dataForm.slsj = data.bdcMortgregist.slsj
                this.dataForm.bah = data.bdcMortgregist.bah
                this.dataForm.isyddyrset = data.bdcMortgregist.isyddyrset
                this.dataForm.isczdy = data.bdcMortgregist.isczdy
                this.dataForm.isczcf = data.bdcMortgregist.isczcf
                this.dataForm.isczzb = data.bdcMortgregist.isczzb
                this.dataForm.lzfs = data.bdcMortgregist.lzfs
                this.dataForm.isqmsqsset = data.bdcMortgregist.isqmsqsset
                this.dataForm.cfjg = data.bdcMortgregist.cfjg
                this.dataForm.cfsj = data.bdcMortgregist.cfsj
                this.dataForm.jfjg = data.bdcMortgregist.jfjg
                this.dataForm.jfsj = data.bdcMortgregist.jfsj
                this.dataForm.isdyzx = data.bdcMortgregist.isdyzx
                this.dataForm.status = data.bdcMortgregist.status
                this.dataForm.descinfo = data.bdcMortgregist.descinfo
                this.dataForm.remark = data.bdcMortgregist.remark
              }
            })
          }
        })
      },
      // 表单提交
      dataFormSubmit () {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.$http({
              url: this.$http.adornUrl(`/bdc/bdcmortgregist/${!this.dataForm.seqno ? 'save' : 'update'}`),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.dataForm.seqno || undefined,
                'sendtime': this.dataForm.sendtime,
                'recvtime': this.dataForm.recvtime,
                'obankid': this.dataForm.obankid,
                'servicecode': this.dataForm.servicecode,
                'ywlx': this.dataForm.ywlx,
                'btype': this.dataForm.btype,
                'djsx': this.dataForm.djsx,
                'realtyno': this.dataForm.realtyno,
                'dymj': this.dataForm.dymj,
                'zxyy': this.dataForm.zxyy,
                'region': this.dataForm.region,
                'bld': this.dataForm.bld,
                'fj': this.dataForm.fj,
                'isdzyxyw': this.dataForm.isdzyxyw,
                'isdjryset': this.dataForm.isdjryset,
                'isbdcset': this.dataForm.isbdcset,
                'isxwblset': this.dataForm.isxwblset,
                'ishtbaset': this.dataForm.ishtbaset,
                'bdbzqse': this.dataForm.bdbzqse,
                'zwlxqssj': this.dataForm.zwlxqssj,
                'zwlxjssj': this.dataForm.zwlxjssj,
                'dbfw': this.dataForm.dbfw,
                'babsm': this.dataForm.babsm,
                'jtjbsm': this.dataForm.jtjbsm,
                'iszzyzb': this.dataForm.iszzyzb,
                'isdygh': this.dataForm.isdygh,
                'isndy': this.dataForm.isndy,
                'isgzwt': this.dataForm.isgzwt,
                'dyconfirm': this.dataForm.dyconfirm,
                'serviceno': this.dataForm.serviceno,
                'slh': this.dataForm.slh,
                'slsj': this.dataForm.slsj,
                'bah': this.dataForm.bah,
                'isyddyrset': this.dataForm.isyddyrset,
                'isczdy': this.dataForm.isczdy,
                'isczcf': this.dataForm.isczcf,
                'isczzb': this.dataForm.isczzb,
                'lzfs': this.dataForm.lzfs,
                'isqmsqsset': this.dataForm.isqmsqsset,
                'cfjg': this.dataForm.cfjg,
                'cfsj': this.dataForm.cfsj,
                'jfjg': this.dataForm.jfjg,
                'jfsj': this.dataForm.jfsj,
                'isdyzx': this.dataForm.isdyzx,
                'status': this.dataForm.status,
                'descinfo': this.dataForm.descinfo,
                'remark': this.dataForm.remark
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.visible = false
                    this.$emit('refreshDataList')
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })
          }
        })
      }
    }
  }
</script>
